﻿using Guoch.Wcf.Host.Svc;
using ProductManager.Inf;
using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace Guoch.Wcf.Host
{
    class Program
    {
        static void Main(string[] args)
        {
            //参考 https://docs.microsoft.com/zh-cn/dotnet/framework/wcf/feature-details/transport-security-with-windows-authentication
            using (ServiceHost host = new ServiceHost(typeof(ProductManger)))
            {
                host.Opened += delegate
                {
                    Console.WriteLine("服务已经启动，输入q回车终止服务！");

                    foreach (var item in host.Description.Endpoints)
                    {
                        Console.WriteLine(item.Address);
                    }
                };

                host.Open();
                var rt = Console.ReadLine();
                while (rt != "q")
                {
                    rt = Console.ReadLine();
                }

            }
        }

    }
}
